<template>
	<view scroll-with-animation scroll-y
		style="height:100%;position: relative;background-color: #F8FBFB;padding-top: 20rpx;padding-bottom: 50rpx;">
		<view style="background-color: #FFFFFF;padding-left: 40rpx;padding-bottom: 20rpx;">
			<view
				style="border-bottom: 2rpx solid #E1E1E1;padding-top: 20rpx;padding-bottom: 20rpx;font-size: 30rpx;font-weight: bolder;">
				基础信息：
			</view>
			<view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view>就诊人：</view>
				<view style="margin-right: 40rpx;">{{usrPersonName}}</view>
			</view>
			<view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view>送检医生:</view>
				<view style="margin-right: 40rpx;">{{doctorName}}</view>
			</view>
			<!-- <view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view>检验编号：</view>
				<view style="margin-right: 40rpx;">615168</view>
			</view> -->
			<view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view>报告时间：</view>
				<view style="margin-right: 40rpx;">{{resultDate}}</view>
			</view>
			<view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view>检验单来源：</view>
				<view v-if="labSource!=null&&labSource==0" style="margin-right: 40rpx;">门诊检验单</view>
				<view v-if="labSource!=null&&labSource==1" style="margin-right: 40rpx;">住院检验单</view>
			</view>
		</view>

		<view v-if="type==0" class="card-plane" style="margin-bottom: 20rpx;">
			<view
				style="border-bottom: 2rpx solid #E1E1E1;padding-top: 20rpx;padding-bottom: 20rpx;font-size: 30rpx;font-weight: bolder;">
				检查类别：{{examClass}}
			</view>
			<view class="crad-row row-border" style="display: flex;align-items: center;justify-content: space-between;">
				<view style="width: 200rpx;">检查所见：</view>
				<view style="margin-right: 40rpx;width: calc( 100% - 200rpx);">{{description}}</view>
			</view>
			<view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view style="width: 200rpx;">诊断：</view>
				<view style="margin-right: 40rpx;width: calc( 100% - 200rpx);">{{impression}}</view>
			</view>
			<view class="crad-row" style="display: flex;align-items: center;justify-content: space-between;">
				<view style="width: 200rpx;">建议：</view>
				<view style="margin-right: 40rpx;width: calc( 100% - 200rpx);">{{recommendation}}</view>
			</view>
		</view>
		<view v-if="type==1" v-for="item in imgUrl">
			<image :src="item"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				wx: "https://app.mzmzb.com",
				userId: undefined,
				problemsList: [],
				id: null,
				usrPersonName: '', //就诊人
				doctorName: '', //就诊医生
				labSource: null, //来源0：门诊检验单 1：住院检验单
				resultDate: '', //报告时间
				type: 0, //类型 0:his拉取  1：手动上传图片
				imgUrl: [], //图片地址
				examClass: '', //检查类别
				description: '', //检查所见
				impression: '', //诊断
				recommendation: '', //建议
			};
		},
		onLoad(option) {
			console.log(option)
			//this.userId = option.userId
			//this.getRecipieList();
			this.id = option.id;
			this.type = option.type;
			if (option.type == 1) {
				this.imgUrl = option.imgUrl.split(",")
			}
			this.getMedicalImageInfo();
		},
		methods: {
			formatDate(value) {
				var date = new Date(value);
				var y = date.getFullYear(),
					m = date.getMonth() + 1,
					d = date.getDate(),
					h = date.getHours(),
					i = date.getMinutes(),
					s = date.getSeconds();
				if (m < 10) {
					m = '0' + m;
				}
				if (d < 10) {
					d = '0' + d;
				}
				if (h < 10) {
					h = '0' + h;
				}
				if (i < 10) {
					i = '0' + i;
				}
				if (s < 10) {
					s = '0' + s;
				}
				var t = y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s;
				return t;
			},
			getMedicalImageInfo() {
				var that = this;
				let openid = uni.getStorageSync('openId')
				let usrUserId = uni.getStorageSync('usrUserId')
				that.func.$request('/getMedicalImageInfo.tz',{id:this.id},'GET').then(res=>{
					if (res.data.success) {
						console.log(res)
						//that.medicalSpecimensList = JSON.parse(JSON.stringify(res.data.result.list));
						//that.number=res.data.result.number
						that.usrPersonName = res.data.result.usrPersonName;
						that.doctorName = res.data.result.doctorName;
						that.labSource = res.data.result.labSource;
						that.resultDate = res.data.result.resultDate;
						that.examClass = res.data.result.examClass;
						that.description = res.data.result.description;
						that.impression = res.data.result.impression;
						that.recommendation = res.data.result.recommendation;
					} else {
						uni.showToast({
							title: '查询失败'
						})
					}
				})
			}
		}
	};
</script>

<style lang="less">
	.add-btn {
		margin: auto;
		height: 88rpx;
		line-height: 88rpx;
		width: 90%;
		background: linear-gradient(90deg, #23E0D3 0%, #00BAAD 100%);
		box-shadow: 0px 20rpx 25rpx 0px rgba(0, 186, 173, 0.4);
		border-radius: 44rpx;
		color: #FFFFFF;
		text-align: center;
	}

	.card-plane {
		background-color: #FFFFFF;
		padding-left: 40rpx;
		padding-bottom: 20rpx;
		margin-top: 20rpx;
	}

	.crad-row {
		margin-top: 20rpx;
	}

	.row-border {
		border-bottom: 2rpx solid #E1E1E1;
	}
</style>